import java.util.Random;
import java.util.Scanner;

public class Demo02 {

    public static void main(String[] args) {
        // 打乱数组
        int[] nums = new int[5];
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < nums.length; i++) {
            System.out.println("请输入" + (i + 1) + "个成绩");
            nums[i] = sc.nextInt();
        }
        for (int num : nums) {
            System.out.print(num + "\t");
        }
        System.out.println();
        Random rand = new Random();
        for (int i = 0; i < nums.length; i++) {
            int index = rand.nextInt(nums.length);
            nums[i] = nums[i] ^ nums[index];
            nums[index] = nums[i] ^ nums[index];
            nums[i] = nums[i] ^ nums[index];
        }
        for (int num : nums) {
            System.out.print(num + "\t");
        }

    }
}
